package com.hzjh.h5mall.http

import com.hzjh.base.http.ApiClient
import com.hzjh.base.http.BaseResponse
import com.hzjh.h5mall.BuildConfig
import com.hzjh.h5mall.bean.ads.AdsDetailBean
import okhttp3.RequestBody
import retrofit2.http.Body
import retrofit2.http.GET
import retrofit2.http.Headers
import retrofit2.http.POST
import retrofit2.http.QueryMap

interface AdsApi {
    //广告详情
    @Headers("Content-Type: application/json;charset=UTF-8")
    @GET("api/front/advertising/ads")
    suspend fun reqAdsDetail(@QueryMap request: Map<String, String>): BaseResponse<AdsDetailBean>
    //接受广告
    @Headers("Content-Type: application/json;charset=UTF-8")
    @POST("api/front/advertising/acceptAds")
    suspend fun reqAdsAccept(@Body request: RequestBody): BaseResponse<String>
    //广告订单详情
    @Headers("Content-Type: application/json;charset=UTF-8")
    @GET("api/front/advertising/advInfo")
    suspend fun reqAdsOrderDetail(@QueryMap request: Map<String, String>): BaseResponse<AdsDetailBean>
    //取消广告
    @Headers("Content-Type: application/json;charset=UTF-8")
    @POST("api/front/advertising/cancelAds")
    suspend fun reqAdsCancel(@Body request: RequestBody): BaseResponse<Any>
    //提交审核
    @Headers("Content-Type: application/json;charset=UTF-8")
    @POST("api/front/advertising/updateAdvInfo")
    suspend fun reqAdsSubmit(@Body request: RequestBody): BaseResponse<String>

    companion object {
        private val api: AdsApi by lazy {
            ApiClient.create(BuildConfig.apiHost,AdsApi::class.java)
        }
        fun create(): AdsApi {
            return api
        }
    }
}